package com.ruibang.glass.produce.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruibang.glass.produce.domain.req.ThicknessTrendRuleReq;
import com.ruibang.glass.produce.entity.ThicknessTrendRule;
import com.ruibang.glass.produce.mapper.ThicknessTrendRuleMapper;
import com.ruibang.glass.produce.service.ThicknessTrendRuleService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.tomcat.jni.FileInfo;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: songJinKang
 * @CreateTime: 2024-02-05  15:17
 * @Description: TODO
 * @Version: 1.0
 */
@Slf4j
@Service
public class ThicknessTrendRuleServiceImpl extends ServiceImpl<ThicknessTrendRuleMapper, ThicknessTrendRule> implements ThicknessTrendRuleService {

    @Override
    public void insert(ThicknessTrendRule thicknessTrendRule) {
        this.save(thicknessTrendRule);
    }

    @Override
    public void edit(ThicknessTrendRule thicknessTrendRule) {
        this.updateById(thicknessTrendRule);
    }

    @Override
    public void deleteById(String id) {
        this.removeById(id);
    }

    @Override
    public Page<ThicknessTrendRule> query(ThicknessTrendRuleReq thicknessTrendRuleReq) {
        return this.lambdaQuery().like(StringUtils.isNotBlank(thicknessTrendRuleReq.getRuleName()), ThicknessTrendRule::getRuleName, "%" + thicknessTrendRuleReq.getRuleName() + "%")
                .page(new Page<>(thicknessTrendRuleReq.getPageNo(), thicknessTrendRuleReq.getPageSize()));
    }


}
